/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

#ifndef NEARLINK_SLE_LITE_TOOL_DELAY_SSAP_SERVER_H
#define NEARLINK_SLE_LITE_TOOL_DELAY_SSAP_SERVER_H


#include "kh_sle_ssap_server.h"
#include "kh_sle_connect.h"
#include "kh_sle_announce.h"
#include "cmd_input.h"
#include "sle_hilog.h"
#include <stdio.h>
#include <string.h>
#include <stdint.h>

#include <stdio.h>
#include <sys/time.h>

#ifdef __LITEOS_M__
#include "common_tool.h"
#include "ohos_init.h"
#include "cmsis_os2.h"
#include "utils_file.h"
#endif // __LITEOS_M__

void OnTRequestWriteDelayLiteCb(SleErrorCode errCode, uint8_t serverId,
                                uint16_t connectId, const SsapsReqWriteCbPara *writeCbPara);
static SleSsapsCallbacks g_ssapsToolDelayLiteCbs = {
        .OnRequestWriteCb = OnTRequestWriteDelayLiteCb,
};

void OnSleTConnStateChangeDelayLiteCb(uint16_t connectId, const SleDeviceAddress *addr
        , SleConnectState connState, SlePairState pairState, SleDisConnectReason discReason);
static SleConnectCallbacks g_connectToolDelayLiteCbs = {
        .OnSleConnStateChangeCb = OnSleTConnStateChangeDelayLiteCb,
};

SleErrorCode IperfStartAnnounce(void);
void TAutoConfigServer(void);
//helper
void SleSsapServerToolHalperDelay(void);

static CmdNode g_ssapServerDelayCmdList[] = {
        //sle_ssap_server_test
        {"SleSsapServerHalper", SleSsapServerToolHalperDelay},
        {"AutoConfigServer", TAutoConfigServer},
};
static uint16_t g_ssapServerDelayCmdNum = sizeof(g_ssapServerDelayCmdList) / sizeof(CmdNode);

#ifdef __LITEOS_M__
void TNotifyIndicateIperfDelay(void);
#else
void *TNotifyIndicateIperfDelay(void *arg);
void *TStartAnnounceIperf(void *arg);
#endif // __LITEOS_M__

#endif //NEARLINK_SLE_LITE_TOOL_DELAY_SSAP_SERVER_H

#ifdef __cplusplus
}
#endif // __cplusplus
